{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/hiddenSharp429/DNN-Python/blob/main/%E7%A5%9E%E7%BB%8F%E7%BD%91%E7%BB%9C.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "e7222efd",
      "metadata": {
        "id": "e7222efd"
      },
      "source": [
        "# 第一步将数据集读入\n",
        "原始的数据集data.txt部分截图：<br>\n",
        "![微信图片_20231204122917.png]()<br>\n",
        "稍微进行改动一下（添加了属性列并将格式转换为.csv）<br>\n",
        "修改后的数据集data.csv部分截图：<br>\n",
        "![image.png]()\n",
        "<br><br>\n",
        "将data.csv读入并且将其存入标识符df中，定义数据集的筛选条件expr_1;expr_2;expr_3\n",
        "- expr_1: 用于赛选Category属性列为iris-setosa的类sql语句\n",
        "- expr_2: 用于赛选Category属性列为Iris-versicolor的类sql语句\n",
        "- expr_3: 用于赛选Category属性列为Iris-virginica的类sql语句\n",
        "\n",
        "用上面定义的筛选条件筛选出数据集中三个类别的数据，并分别存入对应的标识符中。\n",
        "\n",
        "- Iris_setosa_dataframe： 所属类别为Iris-setosa的全部数据\n",
        "- Iris_versicolor_dataframe： 所属类别为Iris-versicolor的全部数据\n",
        "- Iris_virginica_dataframe： 所属类别为Iris-virginica的全部数据"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import os\n",
        "from google.colab import drive\n",
        "from google.colab import files\n",
        "\n",
        "# 如果尚未安装 Google 云端硬盘，请安装它\n",
        "if not os.path.isdir(\"/content/drive/MyDrive\"):\n",
        "    drive.mount('/content/drive', force_remount=True)\n",
        "\n",
        "#@markdown ### 选择上传的模式\n",
        "upload_method = \"Custom Path\" #@param [\"Upload\", \"Custom Path\"]\n",
        "\n",
        "\n",
        "if upload_method == \"Upload\":\n",
        "    uploaded = files.upload()\n",
        "    for filename in uploaded.keys():\n",
        "        os.rename(filename, '/content/sample_data/input_vid.mp4')\n",
        "    PATH_TO_YOUR_VIDEO = '/content/sample_data/input_vid.mp4'\n",
        "\n",
        "elif upload_method == 'Custom Path':\n",
        "    PATH_TO_YOUR_VIDEO = '/content/drive/MyDrive/data.csv' #@param {type:\"string\"}\n",
        "    if not os.path.isfile(PATH_TO_YOUR_VIDEO):\n",
        "        print(\"ERROR: File not found!\")\n",
        "        raise SystemExit(0)\n"
      ],
      "metadata": {
        "id": "f7Zm4ufifDqq"
      },
      "id": "f7Zm4ufifDqq",
      "execution_count": 1,
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "id": "df6755b5-50ad-46f2-8fd4-e894e4f975c0",
      "metadata": {
        "id": "df6755b5-50ad-46f2-8fd4-e894e4f975c0",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "b8d692b5-e102-499d-c33d-91fcd080e2ea"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Iris_setosa_dataframe is:\n",
            "     Sepal.Length  Sepal.Width  Petal.Length  Petal.Width     Category\n",
            "0            5.1          3.5           1.4          0.2  Iris-setosa\n",
            "1            4.9          3.0           1.4          0.2  Iris-setosa\n",
            "2            4.7          3.2           1.3          0.2  Iris-setosa\n",
            "3            4.6          3.1           1.5          0.2  Iris-setosa\n",
            "4            5.0          3.6           1.4          0.2  Iris-setosa\n",
            "5            5.4          3.9           1.7          0.4  Iris-setosa\n",
            "6            4.6          3.4           1.4          0.3  Iris-setosa\n",
            "7            5.0          3.4           1.5          0.2  Iris-setosa\n",
            "8            4.4          2.9           1.4          0.2  Iris-setosa\n",
            "9            4.9          3.1           1.5          0.1  Iris-setosa\n",
            "10           5.4          3.7           1.5          0.2  Iris-setosa\n",
            "11           4.8          3.4           1.6          0.2  Iris-setosa\n",
            "12           4.8          3.0           1.4          0.1  Iris-setosa\n",
            "13           4.3          3.0           1.1          0.1  Iris-setosa\n",
            "14           5.8          4.0           1.2          0.2  Iris-setosa\n",
            "15           5.7          4.4           1.5          0.4  Iris-setosa\n",
            "16           5.4          3.9           1.3          0.4  Iris-setosa\n",
            "17           5.1          3.5           1.4          0.3  Iris-setosa\n",
            "18           5.7          3.8           1.7          0.3  Iris-setosa\n",
            "19           5.1          3.8           1.5          0.3  Iris-setosa\n",
            "20           5.4          3.4           1.7          0.2  Iris-setosa\n",
            "21           5.1          3.7           1.5          0.4  Iris-setosa\n",
            "22           4.6          3.6           1.0          0.2  Iris-setosa\n",
            "23           5.1          3.3           1.7          0.5  Iris-setosa\n",
            "24           4.8          3.4           1.9          0.2  Iris-setosa\n",
            "25           5.0          3.0           1.6          0.2  Iris-setosa\n",
            "26           5.0          3.4           1.6          0.4  Iris-setosa\n",
            "27           5.2          3.5           1.5          0.2  Iris-setosa\n",
            "28           5.2          3.4           1.4          0.2  Iris-setosa\n",
            "29           4.7          3.2           1.6          0.2  Iris-setosa\n",
            "30           4.8          3.1           1.6          0.2  Iris-setosa\n",
            "31           5.4          3.4           1.5          0.4  Iris-setosa\n",
            "32           5.2          4.1           1.5          0.1  Iris-setosa\n",
            "33           5.5          4.2           1.4          0.2  Iris-setosa\n",
            "34           4.9          3.1           1.5          0.1  Iris-setosa\n",
            "35           5.0          3.2           1.2          0.2  Iris-setosa\n",
            "36           5.5          3.5           1.3          0.2  Iris-setosa\n",
            "37           4.9          3.1           1.5          0.1  Iris-setosa\n",
            "38           4.4          3.0           1.3          0.2  Iris-setosa\n",
            "39           5.1          3.4           1.5          0.2  Iris-setosa\n",
            "40           5.0          3.5           1.3          0.3  Iris-setosa\n",
            "41           4.5          2.3           1.3          0.3  Iris-setosa\n",
            "42           4.4          3.2           1.3          0.2  Iris-setosa\n",
            "43           5.0          3.5           1.6          0.6  Iris-setosa\n",
            "44           5.1          3.8           1.9          0.4  Iris-setosa\n",
            "45           4.8          3.0           1.4          0.3  Iris-setosa\n",
            "46           5.1          3.8           1.6          0.2  Iris-setosa\n",
            "47           4.6          3.2           1.4          0.2  Iris-setosa\n",
            "48           5.3          3.7           1.5          0.2  Iris-setosa\n",
            "49           5.0          3.3           1.4          0.2  Iris-setosa\n",
            "Iris_versicolor_dataframe is\n",
            "     Sepal.Length  Sepal.Width  Petal.Length  Petal.Width         Category\n",
            "50           7.0          3.2           4.7          1.4  Iris-versicolor\n",
            "51           6.4          3.2           4.5          1.5  Iris-versicolor\n",
            "52           6.9          3.1           4.9          1.5  Iris-versicolor\n",
            "53           5.5          2.3           4.0          1.3  Iris-versicolor\n",
            "54           6.5          2.8           4.6          1.5  Iris-versicolor\n",
            "55           5.7          2.8           4.5          1.3  Iris-versicolor\n",
            "56           6.3          3.3           4.7          1.6  Iris-versicolor\n",
            "57           4.9          2.4           3.3          1.0  Iris-versicolor\n",
            "58           6.6          2.9           4.6          1.3  Iris-versicolor\n",
            "59           5.2          2.7           3.9          1.4  Iris-versicolor\n",
            "60           5.0          2.0           3.5          1.0  Iris-versicolor\n",
            "61           5.9          3.0           4.2          1.5  Iris-versicolor\n",
            "62           6.0          2.2           4.0          1.0  Iris-versicolor\n",
            "63           6.1          2.9           4.7          1.4  Iris-versicolor\n",
            "64           5.6          2.9           3.6          1.3  Iris-versicolor\n",
            "65           6.7          3.1           4.4          1.4  Iris-versicolor\n",
            "66           5.6          3.0           4.5          1.5  Iris-versicolor\n",
            "67           5.8          2.7           4.1          1.0  Iris-versicolor\n",
            "68           6.2          2.2           4.5          1.5  Iris-versicolor\n",
            "69           5.6          2.5           3.9          1.1  Iris-versicolor\n",
            "70           5.9          3.2           4.8          1.8  Iris-versicolor\n",
            "71           6.1          2.8           4.0          1.3  Iris-versicolor\n",
            "72           6.3          2.5           4.9          1.5  Iris-versicolor\n",
            "73           6.1          2.8           4.7          1.2  Iris-versicolor\n",
            "74           6.4          2.9           4.3          1.3  Iris-versicolor\n",
            "75           6.6          3.0           4.4          1.4  Iris-versicolor\n",
            "76           6.8          2.8           4.8          1.4  Iris-versicolor\n",
            "77           6.7          3.0           5.0          1.7  Iris-versicolor\n",
            "78           6.0          2.9           4.5          1.5  Iris-versicolor\n",
            "79           5.7          2.6           3.5          1.0  Iris-versicolor\n",
            "80           5.5          2.4           3.8          1.1  Iris-versicolor\n",
            "81           5.5          2.4           3.7          1.0  Iris-versicolor\n",
            "82           5.8          2.7           3.9          1.2  Iris-versicolor\n",
            "83           6.0          2.7           5.1          1.6  Iris-versicolor\n",
            "84           5.4          3.0           4.5          1.5  Iris-versicolor\n",
            "85           6.0          3.4           4.5          1.6  Iris-versicolor\n",
            "86           6.7          3.1           4.7          1.5  Iris-versicolor\n",
            "87           6.3          2.3           4.4          1.3  Iris-versicolor\n",
            "88           5.6          3.0           4.1          1.3  Iris-versicolor\n",
            "89           5.5          2.5           4.0          1.3  Iris-versicolor\n",
            "90           5.5          2.6           4.4          1.2  Iris-versicolor\n",
            "91           6.1          3.0           4.6          1.4  Iris-versicolor\n",
            "92           5.8          2.6           4.0          1.2  Iris-versicolor\n",
            "93           5.0          2.3           3.3          1.0  Iris-versicolor\n",
            "94           5.6          2.7           4.2          1.3  Iris-versicolor\n",
            "95           5.7          3.0           4.2          1.2  Iris-versicolor\n",
            "96           5.7          2.9           4.2          1.3  Iris-versicolor\n",
            "97           6.2          2.9           4.3          1.3  Iris-versicolor\n",
            "98           5.1          2.5           3.0          1.1  Iris-versicolor\n",
            "99           5.7          2.8           4.1          1.3  Iris-versicolor\n",
            "Iris_virginica_dataframe is\n",
            "      Sepal.Length  Sepal.Width  Petal.Length  Petal.Width        Category\n",
            "100           6.3          3.3           6.0          2.5  Iris-virginica\n",
            "101           5.8          2.7           5.1          1.9  Iris-virginica\n",
            "102           7.1          3.0           5.9          2.1  Iris-virginica\n",
            "103           6.3          2.9           5.6          1.8  Iris-virginica\n",
            "104           6.5          3.0           5.8          2.2  Iris-virginica\n",
            "105           7.6          3.0           6.6          2.1  Iris-virginica\n",
            "106           4.9          2.5           4.5          1.7  Iris-virginica\n",
            "107           7.3          2.9           6.3          1.8  Iris-virginica\n",
            "108           6.7          2.5           5.8          1.8  Iris-virginica\n",
            "109           7.2          3.6           6.1          2.5  Iris-virginica\n",
            "110           6.5          3.2           5.1          2.0  Iris-virginica\n",
            "111           6.4          2.7           5.3          1.9  Iris-virginica\n",
            "112           6.8          3.0           5.5          2.1  Iris-virginica\n",
            "113           5.7          2.5           5.0          2.0  Iris-virginica\n",
            "114           5.8          2.8           5.1          2.4  Iris-virginica\n",
            "115           6.4          3.2           5.3          2.3  Iris-virginica\n",
            "116           6.5          3.0           5.5          1.8  Iris-virginica\n",
            "117           7.7          3.8           6.7          2.2  Iris-virginica\n",
            "118           7.7          2.6           6.9          2.3  Iris-virginica\n",
            "119           6.0          2.2           5.0          1.5  Iris-virginica\n",
            "120           6.9          3.2           5.7          2.3  Iris-virginica\n",
            "121           5.6          2.8           4.9          2.0  Iris-virginica\n",
            "122           7.7          2.8           6.7          2.0  Iris-virginica\n",
            "123           6.3          2.7           4.9          1.8  Iris-virginica\n",
            "124           6.7          3.3           5.7          2.1  Iris-virginica\n",
            "125           7.2          3.2           6.0          1.8  Iris-virginica\n",
            "126           6.2          2.8           4.8          1.8  Iris-virginica\n",
            "127           6.1          3.0           4.9          1.8  Iris-virginica\n",
            "128           6.4          2.8           5.6          2.1  Iris-virginica\n",
            "129           7.2          3.0           5.8          1.6  Iris-virginica\n",
            "130           7.4          2.8           6.1          1.9  Iris-virginica\n",
            "131           7.9          3.8           6.4          2.0  Iris-virginica\n",
            "132           6.4          2.8           5.6          2.2  Iris-virginica\n",
            "133           6.3          2.8           5.1          1.5  Iris-virginica\n",
            "134           6.1          2.6           5.6          1.4  Iris-virginica\n",
            "135           7.7          3.0           6.1          2.3  Iris-virginica\n",
            "136           6.3          3.4           5.6          2.4  Iris-virginica\n",
            "137           6.4          3.1           5.5          1.8  Iris-virginica\n",
            "138           6.0          3.0           4.8          1.8  Iris-virginica\n",
            "139           6.9          3.1           5.4          2.1  Iris-virginica\n",
            "140           6.7          3.1           5.6          2.4  Iris-virginica\n",
            "141           6.9          3.1           5.1          2.3  Iris-virginica\n",
            "142           5.8          2.7           5.1          1.9  Iris-virginica\n",
            "143           6.8          3.2           5.9          2.3  Iris-virginica\n",
            "144           6.7          3.3           5.7          2.5  Iris-virginica\n",
            "145           6.7          3.0           5.2          2.3  Iris-virginica\n",
            "146           6.3          2.5           5.0          1.9  Iris-virginica\n",
            "147           6.5          3.0           5.2          2.0  Iris-virginica\n",
            "148           6.2          3.4           5.4          2.3  Iris-virginica\n",
            "149           5.9          3.0           5.1          1.8  Iris-virginica\n"
          ]
        }
      ],
      "source": [
        "import pandas as pd\n",
        "\n",
        "df = pd.read_csv(\"drive/MyDrive/data.csv\") # 读取全部列表数据\n",
        "\n",
        "expr_1 = \"Category == 'Iris-setosa'\" # 用于赛选Category属性列为iris-setosa的类sql语句\n",
        "expr_2 = \"Category == 'Iris-versicolor'\" # 用于赛选Category属性列为Iris-versicolor的类sql语句\n",
        "expr_3 = \"Category == 'Iris-virginica'\" # 用于赛选Category属性列为Iris-virginica的类sql语句\n",
        "\n",
        "Iris_setosa_dataframe = df.query(expr_1)\n",
        "Iris_versicolor_dataframe = df.query(expr_2)\n",
        "Iris_virginica_dataframe = df.query(expr_3)\n",
        "\n",
        "print(\"Iris_setosa_dataframe is:\\n\",Iris_setosa_dataframe)\n",
        "print(\"Iris_versicolor_dataframe is\\n\",Iris_versicolor_dataframe)\n",
        "print(\"Iris_virginica_dataframe is\\n\",Iris_virginica_dataframe)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "cbe72d76",
      "metadata": {
        "id": "cbe72d76"
      },
      "source": [
        "# 第二步将数据集按照测试集和训练集分类\n",
        "人为规定训练集占比0.7，数据集为0.3<br>\n",
        "下面将定义一个名为`get_train_and_test_dataframe`的函数，并返回训练集和测试集的DataFrame"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "id": "6b90ddf3-f0e9-446b-bcfc-752556ff965b",
      "metadata": {
        "id": "6b90ddf3-f0e9-446b-bcfc-752556ff965b"
      },
      "outputs": [],
      "source": [
        "total_record, attribute_rows = df.shape # 获取总记录条数和其属性列\n",
        "\n",
        "train_data_rate = 0.7 # 训练集占数据集的比例，即70%\n",
        "test_data_rate = 1 - train_data_rate # 测试集与训练集为互补集\n",
        "\n",
        "def get_train_and_test_dataframe(df1, df2, df3, train_data_rate):\n",
        "    train_df = pd.DataFrame() # 创建一个空的dataframe\n",
        "    test_df = pd.DataFrame() # 创建一个空的dataframe\n",
        "    df_array = [df1, df2, df3] # 将各个df子集存入一个列表用于变量\n",
        "\n",
        "    for i in range(3):\n",
        "        item_df_record_num, _ = df_array[i].shape # 获取每个df子集的记录总条数\n",
        "        item_df_train_record_num = int(item_df_record_num* train_data_rate) # 计算每个df子集的训练数据总记录条数\n",
        "\n",
        "        # 随机从df子集中抽取数量为 itemDf_trainRecordNum 的记录作为训练集\n",
        "        train_records = df_array[i].sample(item_df_train_record_num)\n",
        "\n",
        "        # 子集中除去被选出为测试集的其余记录作为测试集\n",
        "        test_records = df_array[i][~df_array[i].index.isin(train_records.index)]\n",
        "\n",
        "        # 将每个子集中的训练集添加到trainDf中\n",
        "        train_df = pd.concat([train_df, train_records])\n",
        "\n",
        "        # 将每个子集中的测试集添加到testDf中\n",
        "        test_df = pd.concat([test_df, test_records])\n",
        "\n",
        "    return train_df, test_df\n",
        "\n",
        "train_data, test_data = get_train_and_test_dataframe(Iris_setosa_dataframe, Iris_versicolor_dataframe, Iris_virginica_dataframe, train_data_rate)"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "96108d95",
      "metadata": {
        "id": "96108d95"
      },
      "source": [
        "# 第三步定义深度神经网络\n",
        "## 简介\n",
        "\n",
        "## 作用\n",
        "\n",
        "\n",
        "## 接口说明\n",
        "\n",
        "# 返回参数说明\n"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import numpy as np\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "# 定义激活函数sigomid\n",
        "def sigmoid(z):\n",
        "    return 1 / (1 + np.exp(-z))\n",
        "\n",
        "# 定义softmax函数\n",
        "def softmax(z):\n",
        "    exp_z = np.exp(z - np.max(z, axis=1, keepdims=True))\n",
        "    return exp_z / np.sum(exp_z, axis=1, keepdims=True)\n",
        "\n",
        "# 初始化参数\n",
        "def initialize_parameters(input_size, hidden_sizes, output_size):\n",
        "    sizes = [input_size] + hidden_sizes + [output_size] # 使用列表拼接，将输入层的大小，隐藏层大小列表，输出层大小全部放入一个列表里\n",
        "    parameters = {} # 定义一个空的参数字典\n",
        "\n",
        "    for i in range(1, len(sizes)): # 从1循环到sizes的大小减一\n",
        "        parameters['W' + str(i)] = np.random.randn(sizes[i-1], sizes[i]) * 0.01 # 随机生成每层的权重矩阵\n",
        "        parameters['b' + str(i)] = np.zeros((1, sizes[i])) # 初始化每层的偏移矩阵\n",
        "\n",
        "    return parameters\n",
        "\n",
        "# 前向传播\n",
        "def forward_propagation(X, parameters):\n",
        "    cache = {'A0': X}\n",
        "    # print(\"init cache:\", cache)\n",
        "\n",
        "    for i in range(1, len(parameters)//2):\n",
        "        cache['Z' + str(i)] = np.dot(cache['A' + str(i-1)], parameters['W' + str(i)]) + parameters['b' + str(i)]\n",
        "        cache['A' + str(i)] = sigmoid(cache['Z' + str(i)])\n",
        "\n",
        "    # 输出层不使用sigmoid激活函数\n",
        "    cache['A' + str(len(parameters)//2)] = np.dot(cache['A' + str(len(parameters)//2 - 1)], parameters['W' + str(len(parameters)//2)]) + parameters['b' + str(len(parameters)//2)]\n",
        "    cache['O' + str(len(parameters)//2)] = softmax(cache['A' + str(len(parameters)//2)])\n",
        "\n",
        "    # print('final cache:', cache)\n",
        "    return cache\n",
        "\n",
        "# 计算交叉熵损失\n",
        "def compute_loss(Y, Y_hat):\n",
        "    m = Y.shape[0] # 获取Y的样本数\n",
        "    epsilon = 1e-8  # 微小常数，用于数值稳定性，防止出现0的情况\n",
        "    loss = -1/m * np.sum(Y * np.log(Y_hat + epsilon)) # 将总损失除以样本数m，得到平均损失。负号表示最小化损失。\n",
        "    return loss\n",
        "\n",
        "# 反向传播\n",
        "def backward_propagation(X, Y, parameters, cache):\n",
        "    m = X.shape[0]  # 获取样本数\n",
        "\n",
        "    grads = {}  # 初始化梯度字典\n",
        "\n",
        "    # 计算输出层的梯度\n",
        "    dZ_last = cache['O' + str(len(parameters)//2)] - Y  # 计算输出层激活值的梯度\n",
        "    grads['dW' + str(len(parameters)//2)] = 1/m * np.dot(cache['A' + str(len(parameters)//2 - 1)].T, dZ_last)  # 计算输出层权重的梯度\n",
        "    grads['db' + str(len(parameters)//2)] = 1/m * np.sum(dZ_last, axis=0, keepdims=True)  # 计算输出层偏差的梯度\n",
        "\n",
        "    dZ = dZ_last  # 初始化激活值梯度\n",
        "\n",
        "    # 循环计算隐藏层的梯度\n",
        "    for i in range(len(parameters)//2, 1, -1):\n",
        "        dA = np.dot(dZ, parameters['W' + str(i)].T)  # 计算上一层激活值的梯度\n",
        "        dZ = dA * cache['A' + str(i-1)] * (1 - cache['A' + str(i-1)])  # 计算当前层激活值的梯度\n",
        "        grads['dW' + str(i-1)] = 1/m * np.dot(cache['A' + str(i-2)].T, dZ)  # 计算当前层权重的梯度\n",
        "        grads['db' + str(i-1)] = 1/m * np.sum(dZ, axis=0, keepdims=True)  # 计算当前层偏差的梯度\n",
        "\n",
        "    return grads  # 返回计算得到的梯度字典\n",
        "\n",
        "\n",
        "\n",
        "# 更新参数\n",
        "def update_parameters(parameters, grads, learning_rate):\n",
        "    for i in range(1, len(parameters)//2 + 1):\n",
        "        parameters['W' + str(i)] -= learning_rate * grads['dW' + str(i)]\n",
        "        parameters['b' + str(i)] -= learning_rate * grads['db' + str(i)]\n",
        "\n",
        "    return parameters\n",
        "\n",
        "# 模型训练\n",
        "def train_neural_network(X, Y, hidden_sizes, num_epochs, learning_rate=0.01):\n",
        "    input_size = X.shape[1] # 训练集的特征数量（有多少个属性列）\n",
        "    output_size = Y.shape[1] # 期望输出（预测）的所属类型的个数（有多少个类型）\n",
        "\n",
        "    parameters = initialize_parameters(input_size, hidden_sizes, output_size) # 初始化权重w和偏移量b\n",
        "\n",
        "    loss_history = [] # 定义空列表来记录损失函数的状态\n",
        "\n",
        "    for epoch in range(num_epochs):\n",
        "        # 前向传播\n",
        "        cache = forward_propagation(X, parameters)\n",
        "        Y_hat = cache['O' + str(len(parameters)//2)]\n",
        "\n",
        "        # 计算损失\n",
        "        loss = compute_loss(Y, Y_hat)\n",
        "        loss_history.append(loss)\n",
        "\n",
        "        # 反向传播\n",
        "        grads = backward_propagation(X, Y, parameters, cache)\n",
        "\n",
        "        # 更新参数\n",
        "        parameters = update_parameters(parameters, grads, learning_rate)\n",
        "\n",
        "        # 打印损失\n",
        "        if epoch % 2000 == 0:\n",
        "            print(f'Epoch {epoch}, Loss: {loss}')\n",
        "\n",
        "\n",
        "    return parameters, loss_history"
      ],
      "metadata": {
        "id": "8pDLUio2BJEm"
      },
      "id": "8pDLUio2BJEm",
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "id": "5740841b",
      "metadata": {
        "id": "5740841b"
      },
      "source": [
        "# 第四步定义验证和打印函数\n",
        "## 简介\n",
        "`verify`函数是每次循环测试记录时需要调用的，可以用来打印结果和验证是否预测正确。\n",
        "## 入口参数说明\n",
        "- index：测试记录在数据集中的索引\n",
        "- p_catagory：该测试记录经过贝叶斯分类后返回的结果（属于各类别的概率）\n",
        "- real_category：该测试记录真实所属类别\n",
        "- record_num：已经遍历测试记录的数量\n",
        "- correct_num：已经遍历测试记录并且预测结果为正确的数量\n",
        "- correct_rate：该模型的正确率\n",
        "\n",
        "## 返回参数说明\n",
        "- correct_num：同上\n",
        "- correct_rate：同上"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "id": "ae41331d",
      "metadata": {
        "id": "ae41331d"
      },
      "outputs": [],
      "source": [
        "def verify(index, p_catagory, real_category, record_num, correct_num, correct_rate):\n",
        "\n",
        "    print(\"测试结果已出，该测试记录所属类别的概率为\\n\",p_category) # 打印该记录所对应类别的概率\n",
        "    max_probability = max(p_category.values())  # 获取最大的概率值\n",
        "\n",
        "    for key, key_value in p_category.items(): # 寻找概率最大的类别\n",
        "        if key_value == max_probability: ## 找到概率最大的类别\n",
        "            print(f\"第{index}记录的预测最可能的所属类别为:{key}\")\n",
        "            print(f\"第{index}记录的真实属性为:{real_category}\")\n",
        "            if key == real_category: ## 查看预测的类别和真实的类别是否一样\n",
        "                correct_num = correct_num + 1 # 若一样则correct_num++\n",
        "            print(\"-------------------------\")\n",
        "\n",
        "    correct_rate = correct_num / record_num # 计算新的正确率\n",
        "    return correct_num, correct_rate"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# 第五步将训练集数据放入深度神经网络中训练"
      ],
      "metadata": {
        "id": "uLtLoU4XBcIM"
      },
      "id": "uLtLoU4XBcIM"
    },
    {
      "cell_type": "code",
      "source": [
        "# 提取训练集特征和标签\n",
        "X_train = train_data.iloc[:, :-1].values\n",
        "Y_train = pd.get_dummies(train_data['Category']).values\n",
        "\n",
        "# 训练神经网络\n",
        "trained_parameters, loss_history = train_neural_network(X_train, Y_train, hidden_sizes=[5, 4], num_epochs=100000, learning_rate=0.09)\n",
        "\n",
        "# 展示loss的折线图\n",
        "plt.plot(loss_history)\n",
        "plt.title('Loss Over Epochs')\n",
        "plt.xlabel('Epoch')\n",
        "plt.ylabel('Loss')\n",
        "plt.show()"
      ],
      "metadata": {
        "id": "24lKN6AzBooU",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "outputId": "0e97b987-e027-415f-91cd-a71c0e42e1ce"
      },
      "id": "24lKN6AzBooU",
      "execution_count": 6,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Epoch 0, Loss: 1.098653539371582\n",
            "Epoch 2000, Loss: 1.0986122689353426\n",
            "Epoch 4000, Loss: 1.0986121120972154\n",
            "Epoch 6000, Loss: 1.0986117820046577\n",
            "Epoch 8000, Loss: 1.0986107943481844\n",
            "Epoch 10000, Loss: 1.098606195007866\n",
            "Epoch 12000, Loss: 1.0985444397590844\n",
            "Epoch 14000, Loss: 0.5483292369698377\n",
            "Epoch 16000, Loss: 0.07814078794120709\n",
            "Epoch 18000, Loss: 0.036424389012134475\n",
            "Epoch 20000, Loss: 0.023985679426108585\n",
            "Epoch 22000, Loss: 0.017907423458809368\n",
            "Epoch 24000, Loss: 0.01423392852121378\n",
            "Epoch 26000, Loss: 0.011717511661818501\n",
            "Epoch 28000, Loss: 0.009861978839368448\n",
            "Epoch 30000, Loss: 0.008432264185486033\n",
            "Epoch 32000, Loss: 0.007299550706507141\n",
            "Epoch 34000, Loss: 0.0063847482548591555\n",
            "Epoch 36000, Loss: 0.0056351662792017915\n",
            "Epoch 38000, Loss: 0.005013694734677501\n",
            "Epoch 40000, Loss: 0.004493201595636312\n",
            "Epoch 42000, Loss: 0.004053333903642746\n",
            "Epoch 44000, Loss: 0.0036785389640715256\n",
            "Epoch 46000, Loss: 0.003356762978269198\n",
            "Epoch 48000, Loss: 0.0030785559996244012\n",
            "Epoch 50000, Loss: 0.002836436260959738\n",
            "Epoch 52000, Loss: 0.002624428128924024\n",
            "Epoch 54000, Loss: 0.0024377204371329943\n",
            "Epoch 56000, Loss: 0.002272410447182246\n",
            "Epoch 58000, Loss: 0.002125309884912805\n",
            "Epoch 60000, Loss: 0.0019937966341896916\n",
            "Epoch 62000, Loss: 0.0018757004026993633\n",
            "Epoch 64000, Loss: 0.0017692139100868617\n",
            "Epoch 66000, Loss: 0.0016728234124202504\n",
            "Epoch 68000, Loss: 0.0015852539880712275\n",
            "Epoch 70000, Loss: 0.0015054261721594083\n",
            "Epoch 72000, Loss: 0.0014324213739226935\n",
            "Epoch 74000, Loss: 0.001365454134627904\n",
            "Epoch 76000, Loss: 0.001303849745749746\n",
            "Epoch 78000, Loss: 0.0012470260922177998\n",
            "Epoch 80000, Loss: 0.0011944788449090513\n",
            "Epoch 82000, Loss: 0.001145769322739279\n",
            "Epoch 84000, Loss: 0.0011005144939690693\n",
            "Epoch 86000, Loss: 0.0010583787005566299\n",
            "Epoch 88000, Loss: 0.001019066777277494\n",
            "Epoch 90000, Loss: 0.0009823183053239521\n",
            "Epoch 92000, Loss: 0.0009479027929762342\n",
            "Epoch 94000, Loss: 0.0009156156172700543\n",
            "Epoch 96000, Loss: 0.0008852745930574981\n",
            "Epoch 98000, Loss: 0.0008567170614893177\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 1 Axes>"
            ],
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHHCAYAAABZbpmkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABBjklEQVR4nO3de1yUZf7/8ffMAAOI4IEEVAxTU/OUYbKUdlgpMrftYGXlL822WktL41ttbqa1bWF2WHfLsjKr3a0022rbcjWjzA6W67EyD5WplIKSKYjKaa7fHzg3TqChM3DfDq/n4zEPZu657pnP3EPy7jrct8sYYwQAABCm3HYXAAAA0JAIOwAAIKwRdgAAQFgj7AAAgLBG2AEAAGGNsAMAAMIaYQcAAIQ1wg4AAAhrhB0AABDWCDsAcIxYtGiRXC6XXn31VbtLAY4phB3gGPP888/L5XJp2bJldpdSLx9//LEuvvhiJSUlyev1Ki0tTb///e+1ZcsWu0urxR8mDnWbPXu23SUCOAoRdhcAIHw99thjGjdunE444QTdfPPNSklJ0dq1azVz5kzNmTNH8+bN02mnnWZ3mbXccsstOvXUU2ttz8zMtKEaAMEi7ABoEB9//LHGjx+vAQMGaP78+YqNjbWeu/HGG3X66afr0ksv1Zo1a9SyZctGq6u0tFTNmjU7bJuBAwfq0ksvbaSKADQ0hrGAMLVy5UoNHjxY8fHxiouL06BBg/Tpp58GtKmoqNC9996rLl26KDo6Wq1bt9aAAQO0cOFCq01BQYFGjRql9u3by+v1KiUlRRdeeKE2bdp02Pe/77775HK59MILLwQEHUnq1KmTpk6dqm3btumpp56SJD388MNyuVzavHlzrdeaMGGCoqKi9NNPP1nbPvvsM5133nlKSEhQbGyszjzzTH388ccB+91zzz1yuVz66quvdNVVV6lly5YaMGBAvY7fL3G5XBo7dqxefPFFde3aVdHR0UpPT9fixYtrta3PdyFJu3bt0q233qq0tDR5vV61b99eI0aMUFFRUUA7n8+n+++/X+3bt1d0dLQGDRqkb775JqDN119/raFDhyo5OVnR0dFq3769rrjiCu3evTsknx84ltCzA4ShNWvWaODAgYqPj9cdd9yhyMhIPfXUUzrrrLP0wQcfKCMjQ1J1GMjNzdV1112n/v37q7i4WMuWLdOKFSt0zjnnSJKGDh2qNWvW6Oabb1ZaWpq2b9+uhQsXasuWLUpLS6vz/ffu3au8vDwNHDhQHTt2rLPNsGHDdMMNN+itt97SnXfeqcsvv1x33HGHXnnlFd1+++0BbV955RWde+65Vg/Qe++9p8GDBys9PV2TJ0+W2+3Wc889p1//+tf68MMP1b9//4D9L7vsMnXp0kUPPPCAjDG/ePxKSkpqBQxJat26tVwul/X4gw8+0Jw5c3TLLbfI6/XqiSee0HnnnaelS5eqZ8+eR/Rd7NmzRwMHDtTatWt17bXX6pRTTlFRUZHefPNNff/990pMTLTed8qUKXK73brtttu0e/duTZ06VcOHD9dnn30mSSovL1d2drbKysp08803Kzk5WT/88IPeeust7dq1SwkJCb94DICwYgAcU5577jkjyfzvf/87ZJuLLrrIREVFmW+//dbatnXrVtO8eXNzxhlnWNv69OljhgwZcsjX+emnn4wk89BDDx1RjatWrTKSzLhx4w7brnfv3qZVq1bW48zMTJOenh7QZunSpUaS+fvf/26MMcbn85kuXbqY7Oxs4/P5rHZ79+41HTt2NOecc461bfLkyUaSufLKK+tV9/vvv28kHfK2bds2q61/27Jly6xtmzdvNtHR0ebiiy+2ttX3u5g0aZKRZF577bVadfk/p7++7t27m7KyMuv5v/71r0aS+eKLL4wxxqxcudJIMnPnzq3X5wb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eqliRMnavHixfrwww/1ww8/aMaMGSF9D+BYQNgBwozH49G5556rf//73wHLwwsLC/XSSy9pwIAB1pDQjz/+GLBvXFycOnfurLKyMknVq6r2798f0KZTp05q3ry51eZQJk6cKGOMrrnmGu3bty/gue+++0533HGHUlJS9Pvf/z7guaFDh8rj8ejll1/W3Llz9Zvf/CbgvDjp6enq1KmTHn74Ye3Zs6fW++7YseOwdYXSkiVLtGLFCutxfn6+/v3vf+vcc8+Vx+M5ou9i6NChWr16tV5//fVa72PqsYLsYMXFxaqsrAzY1qtXL7nd7l/83oBwxNJz4Bg1a9YszZ8/v9b2cePG6c9//rMWLlyoAQMG6KabblJERISeeuoplZWVaerUqVbbk046SWeddZbS09PVqlUrLVu2TK+++qrGjh0rqbqXYtCgQbr88st10kknKSIiQq+//roKCwt1xRVXHLa+M844Qw8//LBycnLUu3dvXXPNNUpJSdG6dev0zDPPyOfzad68ebVOKNimTRudffbZevTRR1VSUhIwhCVJbrdbM2fO1ODBg9WjRw+NGjVK7dq10w8//KD3339f8fHx+s9//nO0h1WS9OGHH9YKeZLUu3dv9e7d23rcs2dPZWdnByw9l6R7773XalPf7+L222/Xq6++qssuu0zXXnut0tPTtXPnTr355puaMWOG+vTpU+/633vvPY0dO1aXXXaZTjzxRFVWVuof//iHPB6Phg4dejSHBDi22bsYDMCR8i89P9QtPz/fGGPMihUrTHZ2tomLizOxsbHm7LPPNp988knAa/35z382/fv3Ny1atDAxMTGmW7du5v777zfl5eXGGGOKiorMmDFjTLdu3UyzZs1MQkKCycjIMK+88kq96128eLG58MILTWJioomMjDQdOnQw119/vdm0adMh93nmmWeMJNO8eXOzb9++OtusXLnSXHLJJaZ169bG6/Wa448/3lx++eUmLy/PauNfer5jx4561fpLS88nT55stZVkxowZY/75z3+aLl26GK/Xa/r27Wvef//9Wq9bn+/CGGN+/PFHM3bsWNOuXTsTFRVl2rdvb0aOHGmKiooC6vv5kvLvvvvOSDLPPfecMcaYjRs3mmuvvdZ06tTJREdHm1atWp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f5vPPPzcXXnhhnUt3+/btaz777DPz0UcfmS5dugQs3d21a5dJSkoyV199tfnyyy/N7NmzTWxsbK2luxEREebhhx82a9euNZMnTz5ml0PXZeTIkaZdu3bW0vPXXnvNJCYmmjvuuMNqw7E+ciUlJWblypVm5cqVRpJ59NFHzcqVK83mzZuNMc46pvWppT4IOyHy2GOPmQ4dOpioqCjTv39/8+mnn9pdkmNIqvP23HPPWW327dtnbrrpJtOyZUsTGxtrLr74YrNt27aA19m0aZMZPHiwiYmJMYmJieb//u//TEVFRUCb999/35x88skmKirKnHDCCQHv4deUvqufhx2Oc2j85z//MT179jRer9d069bNPP300wHP+3w+c/fdd5ukpCTj9XrNoEGDzPr16wPa/Pjjj+bKK680cXFxJj4+3owaNcqUlJQEtFm9erUZMGCA8Xq9pl27dmbKlCm1annllVfMiSeeaKKiokyPHj3M22+/HfoPbJPi4mIzbtw406FDBxMdHW1OOOEEc9dddwUsZ+ZYH7n333+/zn+TR44caYxx1jGtTy314TLmoFNRAgAAhBnm7AAAgLBG2AEAAGGNsAMAAMIaYQcAAIQ1wg4AAAhrhB0AABDWCDsAACCsEXYANHkul0tvvPGG3WUAaCCEHQC2uuaaa+RyuWrdzjvvPLtLAxAmIuwuAADOO+88PffccwHbvF6vTdUACDf07ACwndfrVXJycsDNf2Vkl8ulJ598UoMHD1ZMTIxOOOEEvfrqqwH7f/HFF/r1r3+tmJgYtW7dWjfccIP27NkT0GbWrFnq0aOHvF6vUlJSNHbs2IDni4qKdPHFFys2NlZdunTRm2++2bAfGkCjIewAcLy7775bQ4cO1erVqzV8+HBdccUVWrt2rSSptLRU2dnZatmypf73v/9p7ty5evfddwPCzJNPPqkxY8bohhtu0BdffKE333xTnTt3DniPe++9V5dffrk+//xznX/++Ro+fLh27tzZqJ8TQAM54kuHAkAIjRw50ng8HtOsWbOA2/3332+MMUaSGT16dMA+GRkZ5sYbbzTGGPP000+bli1bmj179ljPv/3228btdpuCggJjjDFt27Y1d9111yFrkGQmTpxoPd6zZ4+RZP773/+G7HMCsA9zdgDY7uyzz9aTTz4ZsK1Vq1bW/czMzIDnMjMztWrVKknS2rVr1adPHzVr1sx6/vTTT5fP59P69evlcrm0detWDRo06LA19O7d27rfrFkzxcfHa/v27Uf7kQA4CGEHgO2aNWtWa1gpVGJiYurVLjIyMuCxy+WSz+driJIANDLm7ABwvE8//bTW4+7du0uSunfvrtWrV6u0tNR6/uOPP5bb7VbXrl3VvHlzpaWlKS8vr1FrBuAc9OwAsF1ZWZkKCgoCtkVERCgxMVGSNHfuXPXr108DBgzQiy++qKVLl+rZZ5+VJA0fPlyTJ0/WyJEjdc8992jHjh26+eabdfXVVyspKUmSdM8992j06NFq06aNBg8erJKSEn388ce6+eabG/eDArAFYQeA7ebPn6+UlJSAbV27dtW6deskVa+Umj17tm666SalpKTo5Zdf1kknnSRJio2N1YIFCzRu3Dideuqpio2N1dChQ/Xoo49arzVy5Ejt379ff/nLX3TbbbcpMTFRl156aeN9QAC2chljjN1FAMChuFwuvf7667rooovsLgXAMYo5OwAAIKwRdgAAQFhjzg4AR2OkHUCw6NkBAABhjbADAADCGmEHAACENcIOAAAIa4QdAAAQ1gg7AAAgrBF2AABAWCPsAACAsEbYAQAAYe3/AxQ+mFqlPvbkAAAAAElFTkSuQmCC\n"
          },
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# 第六步将测试集数据放入神经网络中验证是否正确"
      ],
      "metadata": {
        "id": "ggvvOH5wBtrj"
      },
      "id": "ggvvOH5wBtrj"
    },
    {
      "cell_type": "code",
      "source": [
        "# 提取测试集特征和标签\n",
        "X_test = test_data.iloc[:, :-1].values\n",
        "Y_test = pd.get_dummies(test_data['Category']).values\n",
        "\n",
        "# 初始化参数\n",
        "correct_rate = 0\n",
        "correct_num = 0\n",
        "record_num = 0\n",
        "class_labels = ['Iris-setosa', 'Iris-versicolor', 'Iris-virginica']\n",
        "\n",
        "for index, record in test_data.iterrows():\n",
        "    record_num = record_num + 1 # 所遍历的测试记录条数+1\n",
        "\n",
        "    Category = record['Category'] # 获取当前测试记录的真实所属类别\n",
        "    print(f'记录:{index}, 所属类别:{Category}')\n",
        "\n",
        "    record_x = [record['Sepal.Length'], record['Sepal.Width'], record['Petal.Length'], record['Petal.Width']] # 将当前测试记录的所有特征值合并成一个列表\n",
        "    print(record_x)\n",
        "\n",
        "    record_x_cache = forward_propagation(record_x, trained_parameters) # 调用深度神经网络进行测试，返回一个字典\n",
        "    result_y = record_x_cache['O' + str(len(trained_parameters)//2)][0] # 用result_y来接收输出层的数据，具体形式是一个概率数组\n",
        "    p_category = {label: value for label, value in zip(class_labels, result_y)} # 将概率数组拓广到字典，即原本的概率列表变成一个概率字典（键值对）\n",
        "    print(p_category)\n",
        "\n",
        "    correct_num, correct_rate = verify(index, p_category, Category, record_num, correct_num, correct_rate) # 更新正确条数和正确率\n",
        "\n",
        "print(f'该模型的预测准确率为:{correct_rate}')\n",
        "\n"
      ],
      "metadata": {
        "id": "WwxjAkOTBs8M",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "c8fbb09e-fb46-41c0-9a3e-6649b3d07910"
      },
      "id": "WwxjAkOTBs8M",
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "记录:0, 所属类别:Iris-setosa\n",
            "[5.1, 3.5, 1.4, 0.2]\n",
            "{'Iris-setosa': 0.9995876870960471, 'Iris-versicolor': 0.0004123128466841663, 'Iris-virginica': 5.726869885221553e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995876870960471, 'Iris-versicolor': 0.0004123128466841663, 'Iris-virginica': 5.726869885221553e-11}\n",
            "第0记录的预测最可能的所属类别为:Iris-setosa\n",
            "第0记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:5, 所属类别:Iris-setosa\n",
            "[5.4, 3.9, 1.7, 0.4]\n",
            "{'Iris-setosa': 0.9995805162674898, 'Iris-versicolor': 0.00041948367392952466, 'Iris-virginica': 5.858080373427034e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995805162674898, 'Iris-versicolor': 0.00041948367392952466, 'Iris-virginica': 5.858080373427034e-11}\n",
            "第5记录的预测最可能的所属类别为:Iris-setosa\n",
            "第5记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:6, 所属类别:Iris-setosa\n",
            "[4.6, 3.4, 1.4, 0.3]\n",
            "{'Iris-setosa': 0.999569362803667, 'Iris-versicolor': 0.000430637135698144, 'Iris-virginica': 6.063485486590333e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.999569362803667, 'Iris-versicolor': 0.000430637135698144, 'Iris-virginica': 6.063485486590333e-11}\n",
            "第6记录的预测最可能的所属类别为:Iris-setosa\n",
            "第6记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:11, 所属类别:Iris-setosa\n",
            "[4.8, 3.4, 1.6, 0.2]\n",
            "{'Iris-setosa': 0.9995553054542033, 'Iris-versicolor': 0.0004446944825505693, 'Iris-virginica': 6.324608283138445e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995553054542033, 'Iris-versicolor': 0.0004446944825505693, 'Iris-virginica': 6.324608283138445e-11}\n",
            "第11记录的预测最可能的所属类别为:Iris-setosa\n",
            "第11记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:12, 所属类别:Iris-setosa\n",
            "[4.8, 3.0, 1.4, 0.1]\n",
            "{'Iris-setosa': 0.9995539943674849, 'Iris-versicolor': 0.00044600556902396783, 'Iris-virginica': 6.349099777602674e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995539943674849, 'Iris-versicolor': 0.00044600556902396783, 'Iris-virginica': 6.349099777602674e-11}\n",
            "第12记录的预测最可能的所属类别为:Iris-setosa\n",
            "第12记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:13, 所属类别:Iris-setosa\n",
            "[4.3, 3.0, 1.1, 0.1]\n",
            "{'Iris-setosa': 0.9995788906537972, 'Iris-versicolor': 0.00042110928732367296, 'Iris-virginica': 5.887926626358979e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995788906537972, 'Iris-versicolor': 0.00042110928732367296, 'Iris-virginica': 5.887926626358979e-11}\n",
            "第13记录的预测最可能的所属类别为:Iris-setosa\n",
            "第13记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:15, 所属类别:Iris-setosa\n",
            "[5.7, 4.4, 1.5, 0.4]\n",
            "{'Iris-setosa': 0.9996072374490943, 'Iris-versicolor': 0.0003927624971803269, 'Iris-virginica': 5.372545879186208e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9996072374490943, 'Iris-versicolor': 0.0003927624971803269, 'Iris-virginica': 5.372545879186208e-11}\n",
            "第15记录的预测最可能的所属类别为:Iris-setosa\n",
            "第15记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:23, 所属类别:Iris-setosa\n",
            "[5.1, 3.3, 1.7, 0.5]\n",
            "{'Iris-setosa': 0.999489661421926, 'Iris-versicolor': 0.0005103385023193564, 'Iris-virginica': 7.575464263826558e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.999489661421926, 'Iris-versicolor': 0.0005103385023193564, 'Iris-virginica': 7.575464263826558e-11}\n",
            "第23记录的预测最可能的所属类别为:Iris-setosa\n",
            "第23记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:25, 所属类别:Iris-setosa\n",
            "[5.0, 3.0, 1.6, 0.2]\n",
            "{'Iris-setosa': 0.9995068094709016, 'Iris-versicolor': 0.0004931904566596299, 'Iris-virginica': 7.243879941732807e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995068094709016, 'Iris-versicolor': 0.0004931904566596299, 'Iris-virginica': 7.243879941732807e-11}\n",
            "第25记录的预测最可能的所属类别为:Iris-setosa\n",
            "第25记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:26, 所属类别:Iris-setosa\n",
            "[5.0, 3.4, 1.6, 0.4]\n",
            "{'Iris-setosa': 0.9995421875999366, 'Iris-versicolor': 0.0004578123343587051, 'Iris-virginica': 6.570476594388545e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995421875999366, 'Iris-versicolor': 0.0004578123343587051, 'Iris-virginica': 6.570476594388545e-11}\n",
            "第26记录的预测最可能的所属类别为:Iris-setosa\n",
            "第26记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:28, 所属类别:Iris-setosa\n",
            "[5.2, 3.4, 1.4, 0.2]\n",
            "{'Iris-setosa': 0.999584219399491, 'Iris-versicolor': 0.00041578054260654767, 'Iris-virginica': 5.790242687155868e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.999584219399491, 'Iris-versicolor': 0.00041578054260654767, 'Iris-virginica': 5.790242687155868e-11}\n",
            "第28记录的预测最可能的所属类别为:Iris-setosa\n",
            "第28记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:31, 所属类别:Iris-setosa\n",
            "[5.4, 3.4, 1.5, 0.4]\n",
            "{'Iris-setosa': 0.9995673703680351, 'Iris-versicolor': 0.0004326295709614086, 'Iris-virginica': 6.100351525551207e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995673703680351, 'Iris-versicolor': 0.0004326295709614086, 'Iris-virginica': 6.100351525551207e-11}\n",
            "第31记录的预测最可能的所属类别为:Iris-setosa\n",
            "第31记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:36, 所属类别:Iris-setosa\n",
            "[5.5, 3.5, 1.3, 0.2]\n",
            "{'Iris-setosa': 0.9995969993501371, 'Iris-versicolor': 0.0004030005942881688, 'Iris-virginica': 5.557470338044601e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995969993501371, 'Iris-versicolor': 0.0004030005942881688, 'Iris-virginica': 5.557470338044601e-11}\n",
            "第36记录的预测最可能的所属类别为:Iris-setosa\n",
            "第36记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:44, 所属类别:Iris-setosa\n",
            "[5.1, 3.8, 1.9, 0.4]\n",
            "{'Iris-setosa': 0.9995389029597505, 'Iris-versicolor': 0.0004610969739258892, 'Iris-virginica': 6.63235846404457e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995389029597505, 'Iris-versicolor': 0.0004610969739258892, 'Iris-virginica': 6.63235846404457e-11}\n",
            "第44记录的预测最可能的所属类别为:Iris-setosa\n",
            "第44记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:46, 所属类别:Iris-setosa\n",
            "[5.1, 3.8, 1.6, 0.2]\n",
            "{'Iris-setosa': 0.9995876381226886, 'Iris-versicolor': 0.00041236182003375946, 'Iris-virginica': 5.727760684702338e-11}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.9995876381226886, 'Iris-versicolor': 0.00041236182003375946, 'Iris-virginica': 5.727760684702338e-11}\n",
            "第46记录的预测最可能的所属类别为:Iris-setosa\n",
            "第46记录的真实属性为:Iris-setosa\n",
            "-------------------------\n",
            "记录:52, 所属类别:Iris-versicolor\n",
            "[6.9, 3.1, 4.9, 1.5]\n",
            "{'Iris-setosa': 0.00021373877112789753, 'Iris-versicolor': 0.9997699635269246, 'Iris-virginica': 1.6297701947386566e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00021373877112789753, 'Iris-versicolor': 0.9997699635269246, 'Iris-virginica': 1.6297701947386566e-05}\n",
            "第52记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第52记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:55, 所属类别:Iris-versicolor\n",
            "[5.7, 2.8, 4.5, 1.3]\n",
            "{'Iris-setosa': 0.00015757000469203484, 'Iris-versicolor': 0.9998160060067055, 'Iris-virginica': 2.642398860230133e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00015757000469203484, 'Iris-versicolor': 0.9998160060067055, 'Iris-virginica': 2.642398860230133e-05}\n",
            "第55记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第55记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:56, 所属类别:Iris-versicolor\n",
            "[6.3, 3.3, 4.7, 1.6]\n",
            "{'Iris-setosa': 0.0002074806893707895, 'Iris-versicolor': 0.9997758058177214, 'Iris-virginica': 1.6713492907730183e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.0002074806893707895, 'Iris-versicolor': 0.9997758058177214, 'Iris-virginica': 1.6713492907730183e-05}\n",
            "第56记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第56记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:58, 所属类别:Iris-versicolor\n",
            "[6.6, 2.9, 4.6, 1.3]\n",
            "{'Iris-setosa': 0.00025835925497495705, 'Iris-versicolor': 0.9997268971748178, 'Iris-virginica': 1.474357020709627e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00025835925497495705, 'Iris-versicolor': 0.9997268971748178, 'Iris-virginica': 1.474357020709627e-05}\n",
            "第58记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第58记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:59, 所属类别:Iris-versicolor\n",
            "[5.2, 2.7, 3.9, 1.4]\n",
            "{'Iris-setosa': 0.00021684383194895332, 'Iris-versicolor': 0.9997668319422147, 'Iris-virginica': 1.6324225836298804e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00021684383194895332, 'Iris-versicolor': 0.9997668319422147, 'Iris-virginica': 1.6324225836298804e-05}\n",
            "第59记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第59记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:66, 所属类别:Iris-versicolor\n",
            "[5.6, 3.0, 4.5, 1.5]\n",
            "{'Iris-setosa': 0.00014254793023232108, 'Iris-versicolor': 0.9998200841384933, 'Iris-virginica': 3.736793127431342e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00014254793023232108, 'Iris-versicolor': 0.9998200841384933, 'Iris-virginica': 3.736793127431342e-05}\n",
            "第66记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第66记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:69, 所属类别:Iris-versicolor\n",
            "[5.6, 2.5, 3.9, 1.1]\n",
            "{'Iris-setosa': 0.00029958741889352103, 'Iris-versicolor': 0.9996864831013887, 'Iris-virginica': 1.3929479717656668e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00029958741889352103, 'Iris-versicolor': 0.9996864831013887, 'Iris-virginica': 1.3929479717656668e-05}\n",
            "第69记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第69记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:72, 所属类别:Iris-versicolor\n",
            "[6.3, 2.5, 4.9, 1.5]\n",
            "{'Iris-setosa': 1.5826593173616593e-07, 'Iris-versicolor': 0.013915251845906657, 'Iris-virginica': 0.9860845898881616}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 1.5826593173616593e-07, 'Iris-versicolor': 0.013915251845906657, 'Iris-virginica': 0.9860845898881616}\n",
            "第72记录的预测最可能的所属类别为:Iris-virginica\n",
            "第72记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:76, 所属类别:Iris-versicolor\n",
            "[6.8, 2.8, 4.8, 1.4]\n",
            "{'Iris-setosa': 0.00019612297189779653, 'Iris-versicolor': 0.9997863909479953, 'Iris-virginica': 1.748608010704508e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00019612297189779653, 'Iris-versicolor': 0.9997863909479953, 'Iris-virginica': 1.748608010704508e-05}\n",
            "第76记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第76记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:80, 所属类别:Iris-versicolor\n",
            "[5.5, 2.4, 3.8, 1.1]\n",
            "{'Iris-setosa': 0.0002970212831034795, 'Iris-versicolor': 0.9996889991199919, 'Iris-virginica': 1.397959690468609e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.0002970212831034795, 'Iris-versicolor': 0.9996889991199919, 'Iris-virginica': 1.397959690468609e-05}\n",
            "第80记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第80记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:83, 所属类别:Iris-versicolor\n",
            "[6.0, 2.7, 5.1, 1.6]\n",
            "{'Iris-setosa': 4.253143575758301e-10, 'Iris-versicolor': 8.950754822860216e-05, 'Iris-virginica': 0.999910492026457}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 4.253143575758301e-10, 'Iris-versicolor': 8.950754822860216e-05, 'Iris-virginica': 0.999910492026457}\n",
            "第83记录的预测最可能的所属类别为:Iris-virginica\n",
            "第83记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:84, 所属类别:Iris-versicolor\n",
            "[5.4, 3.0, 4.5, 1.5]\n",
            "{'Iris-setosa': 0.00010633249965729159, 'Iris-versicolor': 0.9997468089469923, 'Iris-virginica': 0.00014685855335055142}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00010633249965729159, 'Iris-versicolor': 0.9997468089469923, 'Iris-virginica': 0.00014685855335055142}\n",
            "第84记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第84记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:85, 所属类别:Iris-versicolor\n",
            "[6.0, 3.4, 4.5, 1.6]\n",
            "{'Iris-setosa': 0.00024180587298893108, 'Iris-versicolor': 0.9997429460960905, 'Iris-virginica': 1.5248030920464911e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00024180587298893108, 'Iris-versicolor': 0.9997429460960905, 'Iris-virginica': 1.5248030920464911e-05}\n",
            "第85记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第85记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:88, 所属类别:Iris-versicolor\n",
            "[5.6, 3.0, 4.1, 1.3]\n",
            "{'Iris-setosa': 0.00029621022479661783, 'Iris-versicolor': 0.9996897942838995, 'Iris-virginica': 1.3995491303940606e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00029621022479661783, 'Iris-versicolor': 0.9996897942838995, 'Iris-virginica': 1.3995491303940606e-05}\n",
            "第88记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第88记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:90, 所属类别:Iris-versicolor\n",
            "[5.5, 2.6, 4.4, 1.2]\n",
            "{'Iris-setosa': 0.00014164310827269831, 'Iris-versicolor': 0.9998200805912602, 'Iris-virginica': 3.827630046725814e-05}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 0.00014164310827269831, 'Iris-versicolor': 0.9998200805912602, 'Iris-virginica': 3.827630046725814e-05}\n",
            "第90记录的预测最可能的所属类别为:Iris-versicolor\n",
            "第90记录的真实属性为:Iris-versicolor\n",
            "-------------------------\n",
            "记录:103, 所属类别:Iris-virginica\n",
            "[6.3, 2.9, 5.6, 1.8]\n",
            "{'Iris-setosa': 2.321737958153093e-10, 'Iris-versicolor': 5.3858857130546415e-05, 'Iris-virginica': 0.9999461409106956}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.321737958153093e-10, 'Iris-versicolor': 5.3858857130546415e-05, 'Iris-virginica': 0.9999461409106956}\n",
            "第103记录的预测最可能的所属类别为:Iris-virginica\n",
            "第103记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:104, 所属类别:Iris-virginica\n",
            "[6.5, 3.0, 5.8, 2.2]\n",
            "{'Iris-setosa': 2.1645740079815047e-10, 'Iris-versicolor': 5.08251177004992e-05, 'Iris-virginica': 0.9999491746658421}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.1645740079815047e-10, 'Iris-versicolor': 5.08251177004992e-05, 'Iris-virginica': 0.9999491746658421}\n",
            "第104记录的预测最可能的所属类别为:Iris-virginica\n",
            "第104记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:108, 所属类别:Iris-virginica\n",
            "[6.7, 2.5, 5.8, 1.8]\n",
            "{'Iris-setosa': 2.1765823844096337e-10, 'Iris-versicolor': 5.105746910549571e-05, 'Iris-virginica': 0.9999489423132363}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.1765823844096337e-10, 'Iris-versicolor': 5.105746910549571e-05, 'Iris-virginica': 0.9999489423132363}\n",
            "第108记录的预测最可能的所属类别为:Iris-virginica\n",
            "第108记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:112, 所属类别:Iris-virginica\n",
            "[6.8, 3.0, 5.5, 2.1]\n",
            "{'Iris-setosa': 2.7757940893495016e-10, 'Iris-versicolor': 6.251488256594716e-05, 'Iris-virginica': 0.9999374848398548}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.7757940893495016e-10, 'Iris-versicolor': 6.251488256594716e-05, 'Iris-virginica': 0.9999374848398548}\n",
            "第112记录的预测最可能的所属类别为:Iris-virginica\n",
            "第112记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:117, 所属类别:Iris-virginica\n",
            "[7.7, 3.8, 6.7, 2.2]\n",
            "{'Iris-setosa': 2.2362212596343823e-10, 'Iris-versicolor': 5.221030565948068e-05, 'Iris-virginica': 0.9999477894707184}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.2362212596343823e-10, 'Iris-versicolor': 5.221030565948068e-05, 'Iris-virginica': 0.9999477894707184}\n",
            "第117记录的预测最可能的所属类别为:Iris-virginica\n",
            "第117记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:118, 所属类别:Iris-virginica\n",
            "[7.7, 2.6, 6.9, 2.3]\n",
            "{'Iris-setosa': 2.1049717802509742e-10, 'Iris-versicolor': 4.967295951083706e-05, 'Iris-virginica': 0.9999503268299921}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.1049717802509742e-10, 'Iris-versicolor': 4.967295951083706e-05, 'Iris-virginica': 0.9999503268299921}\n",
            "第118记录的预测最可能的所属类别为:Iris-virginica\n",
            "第118记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:125, 所属类别:Iris-virginica\n",
            "[7.2, 3.2, 6.0, 1.8]\n",
            "{'Iris-setosa': 2.8771616395382853e-10, 'Iris-versicolor': 6.442278734430338e-05, 'Iris-virginica': 0.9999355769249395}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.8771616395382853e-10, 'Iris-versicolor': 6.442278734430338e-05, 'Iris-virginica': 0.9999355769249395}\n",
            "第125记录的预测最可能的所属类别为:Iris-virginica\n",
            "第125记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:126, 所属类别:Iris-virginica\n",
            "[6.2, 2.8, 4.8, 1.8]\n",
            "{'Iris-setosa': 1.5993884583829285e-06, 'Iris-versicolor': 0.0996935990392078, 'Iris-virginica': 0.9003048015723338}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 1.5993884583829285e-06, 'Iris-versicolor': 0.0996935990392078, 'Iris-virginica': 0.9003048015723338}\n",
            "第126记录的预测最可能的所属类别为:Iris-virginica\n",
            "第126记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:127, 所属类别:Iris-virginica\n",
            "[6.1, 3.0, 4.9, 1.8]\n",
            "{'Iris-setosa': 4.426517575323002e-07, 'Iris-versicolor': 0.03348515351317763, 'Iris-virginica': 0.9665144038350648}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 4.426517575323002e-07, 'Iris-versicolor': 0.03348515351317763, 'Iris-virginica': 0.9665144038350648}\n",
            "第127记录的预测最可能的所属类别为:Iris-virginica\n",
            "第127记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:129, 所属类别:Iris-virginica\n",
            "[7.2, 3.0, 5.8, 1.6]\n",
            "{'Iris-setosa': 7.157932555853235e-10, 'Iris-versicolor': 0.00013904047223165902, 'Iris-virginica': 0.9998609588119751}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 7.157932555853235e-10, 'Iris-versicolor': 0.00013904047223165902, 'Iris-virginica': 0.9998609588119751}\n",
            "第129记录的预测最可能的所属类别为:Iris-virginica\n",
            "第129记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:132, 所属类别:Iris-virginica\n",
            "[6.4, 2.8, 5.6, 2.2]\n",
            "{'Iris-setosa': 2.170597507269107e-10, 'Iris-versicolor': 5.094156342753983e-05, 'Iris-virginica': 0.9999490582195127}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.170597507269107e-10, 'Iris-versicolor': 5.094156342753983e-05, 'Iris-virginica': 0.9999490582195127}\n",
            "第132记录的预测最可能的所属类别为:Iris-virginica\n",
            "第132记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:134, 所属类别:Iris-virginica\n",
            "[6.1, 2.6, 5.6, 1.4]\n",
            "{'Iris-setosa': 2.3006138680885842e-10, 'Iris-versicolor': 5.3451867843983194e-05, 'Iris-virginica': 0.9999465479020946}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.3006138680885842e-10, 'Iris-versicolor': 5.3451867843983194e-05, 'Iris-virginica': 0.9999465479020946}\n",
            "第134记录的预测最可能的所属类别为:Iris-virginica\n",
            "第134记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:138, 所属类别:Iris-virginica\n",
            "[6.0, 3.0, 4.8, 1.8]\n",
            "{'Iris-setosa': 7.564820981017125e-06, 'Iris-versicolor': 0.359811394156333, 'Iris-virginica': 0.640181041022686}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 7.564820981017125e-06, 'Iris-versicolor': 0.359811394156333, 'Iris-virginica': 0.640181041022686}\n",
            "第138记录的预测最可能的所属类别为:Iris-virginica\n",
            "第138记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:141, 所属类别:Iris-virginica\n",
            "[6.9, 3.1, 5.1, 2.3]\n",
            "{'Iris-setosa': 1.3438671325436452e-08, 'Iris-versicolor': 0.001690067946215684, 'Iris-virginica': 0.9983099186151131}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 1.3438671325436452e-08, 'Iris-versicolor': 0.001690067946215684, 'Iris-virginica': 0.9983099186151131}\n",
            "第141记录的预测最可能的所属类别为:Iris-virginica\n",
            "第141记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "记录:144, 所属类别:Iris-virginica\n",
            "[6.7, 3.3, 5.7, 2.5]\n",
            "{'Iris-setosa': 2.2336386714066367e-10, 'Iris-versicolor': 5.215997386446851e-05, 'Iris-virginica': 0.9999478398027718}\n",
            "测试结果已出，该测试记录所属类别的概率为\n",
            " {'Iris-setosa': 2.2336386714066367e-10, 'Iris-versicolor': 5.215997386446851e-05, 'Iris-virginica': 0.9999478398027718}\n",
            "第144记录的预测最可能的所属类别为:Iris-virginica\n",
            "第144记录的真实属性为:Iris-virginica\n",
            "-------------------------\n",
            "该模型的预测准确率为:0.9555555555555556\n"
          ]
        }
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.11.5"
    },
    "colab": {
      "provenance": [],
      "include_colab_link": true
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}